<?php

namespace App\Modules\LuckDraw\User;

use App\Http\Model\User;

class LuckUser extends LuckUserBase{

    //用户实例
    private static $_instance;
    protected function __construct(?int $luckId = null, ?int $roomId = null, ?object $user = null){
        $this->luckId = $luckId;
        $this->roomId = $roomId;
        $this->user = $user;
        parent::__construct();
    }
    //实例化一个用户
    public static function instance(int $luckId=0, int $roomId=0, object $user = null): LuckUser {
        if (self::$_instance == null){
            self::$_instance =  self::_new($luckId,  $roomId, $user);
        }
        return self::$_instance;
    }

    private static function _new(int $luckId, int $roomId, object $user): LuckUser {
        return new LuckUser($luckId, $roomId, $user);
    }
}